package com.kugong.user;

import com.jfinal.core.Controller;
import com.jfinal.validate.Validator;

/**
 * Created by Administrator on 2015/8/5.
 */
public class UserValidator extends Validator {
    @Override
    protected void validate(Controller controller) {
        validateEmail("user.name", "titleMsg", "请输入正确的邮箱地址");
        validateRegex("user.passWord", "^[0-9_a-zA-Z]{6,10}$", "contentMsg", "密码长度在6-10之间，只能包含字母、数字和下划线");
        validateRegex("user.signName", ".*#\\d{1,10}\\b","signNameMsg", "请输入正确的战网ID，如：昵称#2333");
    }

    @Override
    protected void handleError(Controller controller) {
        controller.render("register.jsp");
    }
}
